﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>ajax</title>
	<meta http-equiv=content-type content="text/html; charset=utf-8"
    <script src="../js/jquery-1.4.2.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function(){
            //设置指示器
            $('#divIndicator').ajaxStart(function(){$(this).show()})
                            .ajaxSuccess(function(){$(this).hide()})
                            .ajaxError(function(msg){$(this).hide();alert("Error"+msg);});
            //ajax get 请求
			 $('#btnGetCubeInGet').click(
				function(){
					$.ajax({
						async:false, 
						url: "http://raywill.0fees.net/test/header.php",
						type: "GET", 
						dataType : "jsonp",
						jsonp: 'jsoncallback',
						data: qsData,
						timeout: 5000, 
						beforeSend: function(){
						}, 
						success: function(json){
							if(json.actionErrors.length!=0){
								alert(json.actionErrors);
							} 
							alert(qsData);
						},
						complete: function(XMLHttpRequest, textStatus){
							alert("m");
						},
						error: function(xhr){
						} 						
					});
				}
			 );
			$.getJSON("http://raywill.0fees.net/test/header.php?"& jsoncallback=?",
			function(json){
				alert("x");
			}); 			 
	          //ajax get 请求
			 $('#btnGetCubeInGetRAW').click(
				function(){
					$.ajax({
						url: "http://raywill.0fees.net/test/userinfo.php",
						type: "GET",
						cache: false,
						dataType : "html",
						success: function(data, textStatus, XMLHttpRequest){
							alert(data);
						}
					});
				}
			 );		 
        });
    </script>
    <style type="text/css">
        .indicator
        {
            color: #FF0000;
            position: absolute;
            top: 0px;
            right: 0px;
            display: none;
        }
    </style>
</head>
<body>
<p><a href="http://code.google.com/p/traveltst/wiki/TravelTaste#%E8%8E%B7%E5%8F%96%E5%9F%BA%E6%9C%AC%E4%BF%A1%E6%81%AF" target="_blank">返回值格式参考</a></p>

    <div id="divIndicator" class="indicator">
        <img src="../img/13221833.gif" />loading</div>
    <label>预计将返回'{"user":"raywill"}'的json脚本，这里将显示得到的用户名信息</label>
	<br>
    <input type="button" id="btnGetCubeInGet" value="Get cube(get)" />
	谢谢
    <input type="button" id="btnGetCubeInGetRAW" value="Get cube(get raw)" />

</body>
</html>
